

///*********************************************************////
///*********************************************************////
///****** Strategic Communication in Dictatorships ************////
///*********************************************************////
///*********************************************************////


clear
use estimation_file

log using "output/analyses_main.smcl", replace

///****************************************************************///
///******                     Table 1                  ***********///
///****************************************************************/// 


xtreg lss_econ gdppcgrowth preselec referendum    maxnumprotests maxsanction midb_event loggdp i.year if v2x_regime<2, fe
est store m2
xtreg lss_econ autocracy  preselec referendum firstterm  gdppcgrowth  maxnumprotests maxsanction loggdp midb_event colorrev i.year if v2x_regime<2, fe
est store m2a
xtreg lss_econ autocracy  preselec referendum firstterm  gdppcgrowth  maxnumprotests maxsanction loggdp midb_event colorrev i.year, fe
est store m2b
xtreg lss_nation  preselec referendum   gdppcgrowth  maxnumprotests maxsanction midb_event loggdp i.year if v2x_regime<2, fe
est store m3
xtreg lss_nation autocracy  preselec referendum  firstterm gdppcgrowth  maxnumprotests loggdp maxsanction midb_event colorrev i.year if v2x_regime<2, fe
est store m3a
xtreg lss_nation autocracy  preselec referendum  firstterm gdppcgrowth  maxnumprotests loggdp maxsanction midb_event colorrev i.year, fe
est store m3b
xtreg lss_fight  preselec referendum     maxnumprotests maxsanction midb_event gdppcgrowth loggdp i.year if v2x_regime<2, fe
est store m1
xtreg lss_fight autocracy firstterm preselec referendum   gdppcgrowth  maxnumprotests loggdp maxsanction midb_event  colorrev i.year if v2x_regime<2, fe
est store m1a
xtreg lss_fight autocracy firstterm preselec referendum   gdppcgrowth  maxnumprotests loggdp maxsanction midb_event  colorrev i.year, fe
est store m1b

estout     m2 m2a m2b m3 m3a m3b m1 m1a m1b, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)))  style(tex) legend label varlabels(_cons Constant) stats(N N_g ll rmse sigma_u rho , fmt(0 3) label(N Ncountries Log-likelihood rmse sigma_u rho )) starlevels(+ 0.10 ** 0.05 *** 0.001) drop(1992.year 1993.year 1994.year 1995.year 1996.year 1997.year 1998.year 1999.year ///
  2000.year 2001.year 2002.year 2003.year 2004.year 2005.year 2006.year 2007.year 2008.year 2009.year 2010.year  ///
  2011.year 2012.year 2013.year 2014.year 2015.year 2016.year 1991.year)
  
  
///****************************************************************///
///******            Figure  Marginal Effects  ***********///
///****************************************************************/// 

/* rescale for the graph */
gen gdppcgrowth2=gdppcgrowth/100
gen maxnumprotests2=maxnumprotests/91
label var gdppcgrowth2 "Economic growth"
label var maxnumprotests2 "Protests"


xtreg lss_econ  preselec referendum  gdppcgrowth2  maxnumprotests maxsanction loggdp midb_event firstterm  autocracy  colorrev i.year if v2x_regime<2, fe
eststo mar1: margins, dydx(*)  post

xtreg lss_nation autocracy  preselec referendum firstterm  gdppcgrowth2  maxnumprotests maxsanction loggdp midb_event colorrev i.year if v2x_regime<2, fe
eststo mar2: margins, dydx(*)  post

xtreg lss_fight autocracy  preselec referendum firstterm  gdppcgrowth2 maxnumprotests maxsanction loggdp midb_event colorrev i.year if v2x_regime<2, fe
eststo mar3: margins, dydx(*)  post

             
/* install coefplot if not installed */ 
/* ssc install coefplot, replace */ 

coefplot  mar1 mar2 mar3, drop(1992.year 1993.year 1994.year 1995.year 1996.year 1997.year 1998.year 1999.year ///
  2000.year 2001.year 2002.year 2003.year 2004.year 2005.year 2006.year 2007.year 2008.year 2009.year 2010.year  ///
  2011.year 2012.year 2013.year 2014.year 2015.year 2016.year )   byopts(xrescale) ///
       grid(none)  xline(0, lcolor(black) lwidth(0.1) lpattern(dash)) ///
xlabel(-2(1)2, labsize(small) angle(0))  ///
   plotlabels("Responsiveness" "Patriotism" "Intimidation", nobreak )   ///
   scheme(s1mono) graphr(m(l-1)) plotr(m(l-1 r-1 t+1 b+5)) legend(rows(1) ///
             size(small) region(lstyle(none)))  ysize(8) xsize(7) 
 graph export output/figure3.pdf, replace 
                       
 
///****************************************************////
///************       Table 2    ****************      ////
///****************************************************//// 
 
clear 
use estimation_file_unga


xtreg lss_econ  wdigrowth v2eltype_6 v2ddyror  anycamp maxsanction  midb_event loggdppc autocracy colorrev i.year if postsoviet==1 & vdem==0 , fe
est store m1
xtreg lss_nation  v2eltype_6 v2ddyror wdigrowth anycamp maxsanction  midb_event  loggdppc autocracy colorrev i.year if postsoviet==1 & vdem==0 , fe
est store m2
xtreg negsentiment  v2eltype_6 v2ddyror wdigrowth anycamp maxsanction   midb_event  loggdppc autocracy colorrev i.year if postsoviet==1 & vdem==0 , fe
est store m3
xtreg lss_econ  v2eltype_6 v2ddyror wdigrowth anycamp maxsanction   midb_event loggdppc  autocracy  i.year if vdem==0 & coldwar==0 , fe
est store m11
xtreg lss_nation  v2eltype_6 v2ddyror wdigrowth anycamp maxsanction   midb_event  loggdppc autocracy i.year if vdem==0 & coldwar==0 , fe
est store m21
xtreg negsentiment  v2eltype_6 v2ddyror wdigrowth anycamp maxsanction  midb_event loggdppc autocracy i.year if vdem==0 & coldwar==0 , fe
est store m31

estout  m1 m11  m2 m21  m3 m31 , cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)))  style(tex) legend label varlabels(_cons Constant) stats(N N_g ll rmse sigma_u rho, fmt(0 0 2 3) ///
label(N Ncountries Log-likelihood rmse sigma_u rho)) starlevels(+ 0.10 ** 0.05 *** 0.001) drop(1990.year  1991.year 1992.year 1993.year 1994.year 1995.year 1996.year 1997.year 1998.year 1999.year ///
  2000.year 2001.year 2002.year 2003.year 2004.year 2005.year 2006.year 2007.year 2008.year 2009.year 2010.year  ///
  2011.year 2012.year 2013.year 2014.year 2015.year 2016.year ) 

   
///****************************************************////
///************  Figure 1  ******      ////
///****************************************************//// 
 
  
 clear
 use data/media/poslania_media.dta
 
 tsset  date, monthly
 
  /* russia  */ 
 graph twoway line Russiaposlanieprezidenta date , lpattern(dash)   lcolor(black) lwidth(medthick)  ///
|| line Russiadenpobedy date , lpattern(dash)   lcolor(gs12) lwidth(medthick)  ///
xlabel(698 709 720 735, valuelabel  labsize(small)) ///
ylabel(0(1000)5000,  valuelabel angle(360) labsize(small)) ///
ytitle("Number of references") ///
xtitle("")   scheme(s1mono)  ///
legend(off  ) ///
 title("Russia", size(large)) ///
  graphregion(margin(b+10))
 graph export output/figure1A.pdf, replace  
 
 /* kazakhstan  */ 
 graph twoway line Kazakhstanposlanieprezidenta date , lpattern(dash)   lcolor(black) lwidth(medthick)      ///
|| line Kazakhstandenpobedy date , lpattern(dash)   lcolor(gs12) lwidth(medthick)  ///
|| line Kazakhstandennezavisimosti date , lpattern(dot)   lcolor(black) lwidth(medthick)  ///
xlabel(696 705 716 728 740, valuelabel  labsize(small)) ///
ylabel(0(100)600,  valuelabel angle(360) labsize(small)) ///
ytitle("Number of references") ///
xtitle("")   scheme(s1mono)  ///
legend(on order(1 "Address of the president" 2 "Victory Day" 3 "Independence Day")  ///
 size(medsmall) region(lcolor(white)) rows(1)  ) ///
 title("Kazakhstan", size(large)) ///
  graphregion(margin(l+2)) 
 graph export output/figure1B.pdf, replace  

 
log close
 
 
 

 
 
